{extend name="public/base"/}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/writer/style/books.css">
<style>
	.cgxlabelwrap {
		position: absolute;
		top: 60px;
		/* width: 100%; */
	}
	#timing_mark {
		font-size: 12px;
		background: #effcff;
		border: 1px solid #40ace1;
		border-radius: 20px;
		padding: 0 5px;
		display: none;
		float: left;
		line-height: 16px;
		margin-right: 5px;
		height: 18px;
	}
	.zwText .save-fail {
		font-size: 12px;
		color: #eb5255;
		background: #ffefef;
		border: 1px solid #eb5255;
		border-radius: 20px;
		padding: 0 5px;
		float: left;
		line-height: 16px;
		margin-right: 5px;
		height: 18px;
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;
		max-width: 600px;
		position: absolute;
		left: 0;
		top: 0;
	}
	#forbidWords em{cursor:pointer;font-style:normal;}
	#contentHtml {display: none;font-size: 14px;}
	#contentHtml:focus{outline:0px solid transparent;}
	#contentHtml span{background:yellow}

	#titleHtml {display: none;height: 46px;line-height:46px;margin:20px 0 10px 0;border-bottom: 1px solid #e6e6e6;}
	#titleHtml:focus{outline:0px solid transparent;}
	#titleHtml span{background: yellow}
	.zwText {overflow-y: auto;}
	.layui-this{background-color:#00abff!important; }
	#cindextitle{
		float: left;
		width: 150px;
	}
	#title{
		float: left;
		width: 400px;
	}
</style>
{/block}
{block name="body"}
    {include file="public/topmenu" /}
    {include file="public/changepwd" /}
    <div class="mainWrap pageCenter cf">     
        {include file="public/leftmenu" /}
        <link rel="stylesheet" type="text/css" href="__PUBLIC__/writer/style/timing_plugin.css">
        <link charset="utf-8" rel="stylesheet" href="__PUBLIC__/writer/style/DatePicker.css">
        <link charset="utf-8" rel="stylesheet" href="__PUBLIC__/writer/style/Dropdown.css">
        <link charset="utf-8" rel="stylesheet" href="__PUBLIC__/writer/style/TimePicker.css">
        <link charset="utf-8" rel="stylesheet" href="__PUBLIC__/writer/style/Popup.css">
		<script type="text/javascript" src="__PUBLIC__/writer/js/tinymce.min.js"></script>
        <script id="mce_5" type="text/javascript" src="__PUBLIC__/writer/js/plugin.min.js"></script>
        <link rel="stylesheet" type="text/css" id="u0" href="__PUBLIC__/writer/style/skin.min.css">
        <div class="mainRight pb0 fl">
            <div class="crumbsWrap"><i class="before"><a href="{:url('writer/booknovels/index')}"><span>作品管理</span></a></i><em class="same"></em> <i class="current"><span>{$book['title']}</span></i>
                <!--<em class="diff"></em><i class="current"><span>章节管理</span></i>-->
            </div>

            <div class="msgBoxTitle">
                <a class="create button" href="{:url('writer/booknovels/addchapter',['bookid'=>$book['id']])}"><em class="icon"></em>新建章节</a>
                        <a id="createVolumeIconBtn" class="button white" href="javascript:">新建分卷</a>

                <div class="tabSwitch cf">
					<span ><a href="{:url('writer/booknovels/info',['bookid'=>$book['id']])}">作品设置</a></span>
                    <span><a href="{:url('writer/booknovels/draft',['bookid'=>$book['id']])}">草稿箱</a></span>
                    <span class="act"><a href="{:url('writer/booknovels/publish',['bookid'=>$book['id']])}">已发布章节</a></span>
                    <span><a href="{:url('writer/booknovels/recycle',['bookid'=>$book['id']])}">回收站</a></span>           
                </div>
            </div>
            <div class="managerWrap cf">
                <div class="mLeftList fl">
                    <div id="chapterListWrap" class="leftListWrap">
                        <div class="titleBox">
                            <p>共 {$volumes|count} 卷， {$chapternum} 章</p>
                        </div>
                        <div class="sectionManage">
                            <div id="chapterList" class="sectionList volumeList ">
                                <ul>
									{notempty name="chapters"}
									<div class="volume" data-node="volumeItem" data-volumeid="0">
                                        <div class="volumeBox">
                                            <p><cite></cite>普通章节<span>共{$chapters|count}章</span></p>
                                            <p class="f12"></p>
                                        </div>
                                    </div>
										<div class="sectionWrap show" data-node="chapterItemList" style="display: block;">
                                            {volist name="chapters" id="ch" key="index"}
                                            <li data-node="chapterItem" data-chapterid="{$ch['id']}"  {if $index==0}class="act"{/if}>
                                                <div class="sectionBox">
                                                     <p><em>{$ch['chaptername']}</em></p>
                                                        <p class="f12"><i>{$ch['update_time'] | date="m-d H:i",###} </i>共{$ch['size']}字</p>
                                                    </div>
                                            </li>    
                                            {/volist}                        
                                        </div> 
									{/notempty}
									{notempty name="volumes"}
                                    {volist name="volumes" id="vo"}
                                    <div class="volume" data-node="volumeItem" data-volumeid="{$vo['id']}">
                                        <div class="volumeBox">
                                            <p><cite></cite>{$vo['chaptername']}                                                        
                                                <span>共{$vo['chapters']|count}章</span></p>
                                                <p class="f12">                                           
                                            </p>
                                        </div>
                                        </div>
                                        <div class="sectionWrap show" data-node="chapterItemList" style="display: block;">
                                            {volist name="vo.chapters" id="ch" key="index"}
                                            <li data-node="chapterItem" data-volumeid="{$vo['id']}" data-chapterid="{$ch['id']}"  {if $index==0}class="act"{/if}>
                                                    <div class="sectionBox">
                                                        <p><em>{$ch['chaptername']}</em></p>
                                                        <p class="f12"><i>{$ch['update_time'] | date="m-d H:i",###} </i>共{$ch['size']}字</p>
                                                    </div>
                                            </li>    
                                            {/volist}                        
                                        </div>    
                                    {/volist} 
									{/notempty}    
                                <div class="sectionWrap show" data-node="chapterItemList">
																			</div>                        </ul>
							</div>
						</div>
					</div>
				</div>
                <!-- 查看/编辑章节 -->
                <div id="chapterContainer" class="mRightContent fl">
                    <!--查看章节-->
                     <div  id="viewChapterBox" class="midWrap viewWrap hidden">

                        <div class="sectionViewWrap section-pre-view">
                            <div id="viewChapterBtnBox" class="sectionBtnBox cf ">
								<div class="titleBtn fr">
									<a id="applyChapterBan" class="button white" style="display:none" href="javascript:">申请解禁</a>
									<a id="deleteChapterBtn" class="button white" href="javascript:">删除</a>
									<a id="editChapterBtn" class="button modify" href="javascript:">修改</a>
								</div>
								<em class="c999">章节类型：</em>
								<b data-node="chapterTypeName"></b>
							</div>

							<div id="sectionText" class="zwText">
								<h3 id="chapterTitle"></h3>
								<div id="chapterContent"></div>
							</div>

							<div class="authorSay">
								<div id="authorSpeak"></div>
							</div>

					</div>
				</div>


                    <!-- 编辑章节 -->
                    <div id="editChapterBox" class="midWrap editWrap hidden">
                        <div class="sectionViewWrap ">
                            <div id="editChapterBtnBox" class="sectionBtnBox cf">
								<div class="titleBtn fr">
									<a id="checkContentWordsBtn" class="button white" href="javascript:">统计字数</a>
									<a id="saveChapterBtn" class="button save" href="javascript:"><span class="icon"></span>保存</a>
								</div>
								<em class="c999">章节类型：</em>
								<b data-node="chapterTypeName"></b>
							</div>

                            <form id="formChapter" name="formChapter" method="post" action="{:url('writer/booknovels/addchapter',array("bookid"=>$book['id']))}">
                                <input type="hidden" name="CBID" value="{$book['id']}">
                                <input id="typeHidden" type="hidden" name="type" value="update">
                                <input id="chapterIdHidden" type="hidden" name="CCID" value="">
                             <div class="zwText">
									<div id="sectionEdit">
										<div class="cgxlabelwrap">
											<span id="timing_mark" style="display: none;"></span>
											<span class="save-fail" id="forbidWords" style="display:none;">敏感词:</span>
										</div>
										<input id="chapterTitleInput" name="chaptertitle" type="text" data-default=""/>
										<div class="tinyMCE-wrap" style="display: none;">
											<textarea id="textMce">
											</textarea>
											
										</div>
										<div id="titleHtml" contenteditable="true"></div>
										<div id="contentHtml" contenteditable="true"></div>
										<textarea name="content" id="chapterContentInput" style="display: none;" data-default="请输入正文"></textarea>
									</div>
							</div>
                            </form>
                        </div>
                    </div>
                </div>
                <!--查看/编辑分卷-->
                <div id="volumeContainer" class="mRightContent fl hidden" style="display: none;">
                    <!-- 查看分卷 -->
                    <div id="viewVolumeBox" class="hidden" style="display: block;">
                        <div class="sectionBtnBox cf">
                            <div id="viewVolumeEdit" class="titleBtn fr" style="display: block;">
                                <a id="deleteVolumeBtn" class="button white" href="javascript:"><span class="icon"></span>删除</a>
                                <a id="editVolumeBtn" class="button modify" href="javascript:"><span class="icon"></span>修改</a>
                            </div>
                        </div>
                        <div class="newVolume">
                            <h3><b data-node="volumeSortName">第一卷</b><span data-node="chapterCountBox">本卷章节 <em data-node="chapterCount">1</em> 章</span></h3>
                        </div>
                        <div class="volumeForm" data-node="viewContentBox" style="display: block;">
                            <ul>
                                <li>
                                    <em>分卷名称</em>
                                    <p id="volumeTitle"></p>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <!-- 编辑分卷 -->
                    <div id="editVolumeBox" class="hidden" style="display: none;">
                        <div class="sectionBtnBox cf">
                            <div class="titleBtn fr">
                                <a id="saveVolumeBtn" class="button save" href="javascript:"><span class="icon"></span>保存</a>
                            </div>
                        </div>
                        <div class="newVolume">
                            <h3><b data-node="volumeSortName"></b><span id="chapterCountView">本卷章节<b data-node="chapterCount"></b>章</span></h3>
                        </div>
                        <div data-node="contentBox" class="volumeForm">
                            <ul>
                                <li>
                                    <em>分卷名称</em>
                                    <input id="volumeTitleInput" class="midInput" type="text">
                                </li>
                                <li>
                                    <em>分卷介绍</em>
                                    <textarea id="volumeDescInput"></textarea>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        <img id="requestLoadingTip" class="loadImg" style="display: none;" src="/public/writer/images/loading.gif"></div>
       

        
        <!-- start 操作确认-->
        <div class="popupWrap w450 hidden" id="apply_chapter_box" style="position: fixed;z-index: 10000;left:50%; top:50%; margin: -150px 0 0 -250px"><a class="icon closePopup" href="javascript:"></a>
            <h3>申诉解禁申请</h3>
            <div class="popupBody p30">
                <div class="popupContent text-area">
                    <p>屏蔽时间：<span id="lockTime"></span></p>
                    <p>请填写章节申诉内容，我们将会在15个工作日内审核答复</p>
                    <textarea class="clearText" placeholder="请详细描述你需要申请解禁章节的原因，包括但不限于章节违规内容已修改等事由" def="请详细描述你需要申请解禁章节的原因，包括但不限于作品违规内容已修改等事由" id="clearText"></textarea>
                    <p class="error-tip"></p>
                </div>
                <div class="confirmBtn">
                    <a class="button ok" href="javascript:">确认</a>
                    <a class="button white cancal" href="javascript:">取消</a>
                </div>
            </div>
        </div>
        
        <script type="text/javascript">
            var default_photo="https://img1.write.qq.com/writer/p1/contentv2/dafult_photo.png";
        </script>
        <!-- start 角色管理 有数据 -->
        <div class="popup-wrap character-control" id="roleManagePopup" style="display: none;">
            <a class="close icon" href="javascript:" data-node-man-role="close"></a>
            <div class="popup-title">
                <a class="add-character" href="javascript:">添加角色</a>
                <h3>角色管理</h3>
            </div>
            <div class="popup-content">
                <div class="slimScrollDiv" style="position: relative; overflow: hidden; width: auto; height: 528px;"><div class="character-list-wrap" id="j-characterList" style="overflow: hidden; width: auto; height: 528px;">
                    <ul>

                    </ul>
                </div><div class="slimScrollBar" style="background: rgb(204, 204, 204); width: 8px; position: absolute; top: 0px; opacity: 1; display: block; border-radius: 0px; z-index: 99; right: -1px;"></div><div class="slimScrollRail" style="width: 8px; height: 100%; position: absolute; top: 0px; display: none; border-radius: 0px; background: rgb(238, 238, 238); opacity: 1; z-index: 90; right: -1px;"></div></div>
            </div>
            <div class="popup-btn full">
                <a id="roleManageFinish" href="javascript:" data-node-man-role="close">完成</a>
            </div>
        </div>
        <!-- end 角色管理 有数据 -->

        <!-- start 删除角色二次确认 没有发言过的 -->
        <div class="popup-tip" id="roleDeletePopup" style="display: none;">
            <div class="popup-content">
                <div class="text-content">
                    <p>是否删除本角色？</p>
                </div>
            </div>
            <div class="popup-btn">
                <a id="roleDeleteCancel" href="javascript:" data-node-del-role="close">取消</a>
                <a id="roleDeleteConfirm" href="javascript:">删除</a>
            </div>

        </div>
        <!-- end 删除角色二次确认 没有发言过的 -->
        <!-- end 操作确认-->
        <!-- end 插入视频弹窗 -->
        <script type="text/javascript" src="__PUBLIC__/writer/js/chapterJp.js"></script><script type="text/javascript" src="__PUBLIC__/writer/js/chapterManage.js"></script><script type="text/javascript">
            $(function () {
                var CBID = {$book['id']},
                    isVipNovel = "-1",
                    newVolumeName = "第{php} echo numToWord(count($volumes)+1){/php}卷",
                    isGuide = 1,
                    isGuideVolume = "1", //1显示  0隐藏
                    isAddChapterUrl = "", //1写新章节  0默认显示最新一章章节
                    allchapter      ="0",//总章节数
                    _tinymce = tinymce,//富文本组件
                    imgSrc = "http://write.lveshu.com",
					fineLayoutType = "2";
                //角色
                $('#roletype').comboSelect();
                CS.page.bookManage.roleMange.init(CBID);//角色管理
                CS.page.tinymce.create_chapter.init(CBID,imgSrc);
                CS.page.bookManage.chapterManage.init(CBID, isVipNovel, newVolumeName, isGuide, isGuideVolume, isAddChapterUrl,allchapter,_tinymce);
            });
        </script>
        
    </div>
    {include file="public/footer" /}
<script type="text/javascript">
/*
    $(function () {
        var imgUrl = "";
        var artidx = "0";
        var selectid = "0";
        var articlename = "";

        CS.page.bookNovels.novelList.init(imgUrl,artidx,articlename,selectid);
    });*/
    $('#novelList').on('mouseenter', 'tr',
    function() {
        $(this).addClass('active').siblings('tr').removeClass('active');
    });
</script>
{/block}
{block name="script"}
{/block}


